﻿

using LJ.Abstractions;
using LJ.Abstractions.Config;
using LJ.Abstractions.Extensions;
using LJ.Abstractions.Thread;
using LJ.Host.Abstractions.Config;

namespace LJ.Host.Abstractions;

public class AppProvider(IServiceProvider serviceProvider) : IAppProvider
{
    private readonly Lazy<IConfigProvider> _configProvider = serviceProvider.GetRequiredService<Lazy<IConfigProvider>>();

    private readonly Lazy<ICancellationTokenProvider> _cancellationTokenProvider = serviceProvider.GetRequiredService<Lazy<ICancellationTokenProvider>>();

    public IConfigProvider ConfigProvider => _configProvider.Value;

    public IServiceProvider ServiceProvider => serviceProvider;

    public ICancellationTokenProvider CancellationTokenProvider => _cancellationTokenProvider.Value;

    public ILogger GetLogger<T>()
    {
        return ServiceProvider.GetLogger<T>();
    }
}